
import 'dart:io';

import 'package:baselib/utils/gallery_camera_pick_util.dart';
import 'package:baselib/utils/image_util.dart';
import 'package:baselib/utils/keyboard_util.dart';
import 'package:baselib/utils/load_util.dart';
import 'package:baselib/utils/log_util.dart';
import 'package:baselib/utils/md5_util.dart';
import 'package:baselib/utils/navigator_util.dart';
import 'package:baselib/utils/px_base_util.dart';
import 'package:baselib/utils/toast_util.dart';
import 'package:baselib/widgets/dialog_util.dart';
import 'package:flutter/material.dart';
import 'package:framelib/base/base_view_model.dart';
import 'package:framelib/config/api_config.dart';
import 'package:framelib/net/baseentity.dart';
import 'package:framelib/utils/oss_util.dart';
import 'package:framelib/utils/string_util.dart';
import 'package:module_business/module_chat/model/gift_entity.dart';
import 'package:module_business/module_chat/service/module_chat_service.dart';
import 'package:module_business/module_index/model/voice_chat_tag_entity.dart';
import 'package:module_business/module_index/service/module_index_service.dart';
import 'package:module_business/module_index/view/create_voice_room_widget.dart';
import 'package:get/get.dart';
import 'package:module_business/module_my/service/module_my_service.dart';

class GiftsBottomSheetViewModel extends BaseViewModel<ModuleChatService>{

  ModuleChatService moduleChatService;
  ModuleMyService moduleMyService;
  //礼物列表
  List<GiftEntity> giftsDatas = [];
  TextEditingController numTextEditingController = TextEditingController(text: '1');

  @override
  ModuleChatService createService(){
    moduleMyService = ModuleMyService();
    return moduleChatService = ModuleChatService();
  }

  @override
  void onInit() {
    super.onInit();
    getGiftsList();
  }
  @override
  void onClose() {
    if(numTextEditingController!=null)numTextEditingController.dispose();
    super.onClose();
  }
  void getGiftsList() async{
    Map<String,dynamic> upData={};
    BaseEntity baseEntity = await moduleMyService.api_voicechat_gift_list(parmsMap: upData);
    if(baseEntity?.code == ApiConfig.SUCCESS_CODE){
      giftsDatas = baseEntity?.result??[];
    }
    update();
  }
}
